#! /bin/sh

# vPresent is an immersive presentation creation and display application.
# Copyright (C) 2007 by Infiscape Corporation
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

# vpresentd init file for vpresentd on Debian/Ubuntu
# pidfile: /var/run/vpresentd.pid

### BEGIN INIT INFO
# Provides:		vpresentd
# Required-Start:	gdm
# Required-Stop:
# Default-Start:	5
# Default-Stop:		0 1 2 3 4 6
# Short-Description:	The vpresentd render server
# Description:		The vpresentd render server displays graphics
#			distributed on a cluster by OpenSG.
### END INIT INFO


# To install:
#update-rc.d vpresentd multiuser >/dev/null

. /lib/lsb/init-functions


RETVAL=0

prog="vpresentd"

start() {
   log_daemon_msg "Starting vpresentd" "vpresentd"

   if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/vpresentd.pid --exec /usr/sbin/vpresentd ; then
      log_end_msg 0
   else
      log_end_msg 1
   fi
}

stop() {
   log_daemon_msg "Stopping vpresentd" "vpresentd"
   if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/vpresentd.pid ; then
      log_end_msg 0
   else
      log_end_msg 1
   fi
}

restart() {
   log_daemon_msg "Restarting vpresentd" "vpresentd"
   if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/vpresentd.pid --exec /usr/sbin/vpresentd ; then
      log_end_msg 0
   else
      log_end_msg 1
   fi
}

case "$1" in
   start)
      start
      ;;
   stop)
      stop
      ;;
   restart)
      restart
      ;;
#   status)
#      status $prog
#      ;;
   *)
      log_action_msg "Usage: /etc/init.d/vpresentd {start|stop|restart}"
      exit 1
esac

exit $?
